<template>
  <div v-if="visible" class="base-drawer" @click.stop="close">
    <div ref="conrent" class="content" @click.stop>
      <slot />
    </div>
  </div>
</template>
<script>
export default {
  name: 'BaseDrawer',
  props: {
    visible: {
      default: false,
      type: Boolean
    }
  },
  methods: {
    close() {
      this.$emit('update:visible', false)
    }
  }
}
</script>
<style lang="scss" scoped>
.base-drawer {
  position: fixed;
  z-index: 2000;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.5);
}
.content {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 800px;
  background: #fff;
  animation: move 0.2s;
}
@keyframes move {
  0% {
    right: -800px;
  }
  100% {
    right: 0px;
  }
}
</style>
